import request from "@/utils/request.js";
import store from "@/store/index.js";

/* export const app = () => {
  return request({
    url: '/app/',
  })
} */

// export default {
//   // 登录
//   login_api: data => {
//     return request({
//       method: "POST",
//       url: "/app/v1_0/authorizations",
//       data
//     });
//   },
//   getUserInfo: () => {
//     return request({
//       method: "GET",
//       url: `/app/v1_0/user`
//       /* headers: {
//       Authorization: `Bearer ${store.state.user.token}`
//     } */
//     });
//   }
// };

// 登录
export const login_api = data => {
  return request({
    method: 'POST',
    url: '/app/v1_0/authorizations',
    data
  })
}

// 短信验证码
export const sendVc = mobile => {
  return request({
    method: 'GET',
    url: `/app/v1_0/sms/codes/${mobile}`
  })
}

// 获取用户自己的信息
export const getUserInfo = () => {
  return request({
    method: 'GET',
    url: `/app/v1_0/user`,
    /* headers: {
      Authorization: `Bearer ${store.state.user.token}`
    } */
  })
}

// 获取用户频道列表
export const getUserChannels = () => {
  return request({
    method: 'GET',
    url: `/app/v1_0/user/channels`
  })
}

// 请求获取文章列表数据
export const getArticles = params => {
  return request({
    method: 'GET',
    url: `/app/v1_1/articles`,
    params
  })
}
